home *** CD-ROM | disk | FTP | other *** search
/ Chip 1997 December / CHIP Turkiye Aralık 1997.iso / grafik / masterc / demo / disk1 / demopost.pst < prev    next >
Text File  |  1994-11-23  |  31KB  |  758 lines

  1. # -------------------------------------------------------------------------- 
  2. #| MASTERCAM MP POST PROCESSOR    | Always back up your post-processor      |
  3. #| CNC Software, Inc.             | prior to making any changes. It's easy, |
  4. #| Control Model: FANUC 6M+       | just put a floppy in drive a:, at DOS   |
  5. #| Machine Model: GENERIC         | type "COPY C:\NC\*.PST A:"              |
  6. #| PST File Name: MPFAN.PST/TXT   |                                         |
  7. #| Executable   : MP.EXE 3.06     |                                         |
  8. # -------------------------------------------------------------------------- 
  9. #
  10. # --------------- 
  11. #| REVISION LOG  |
  12. # ------------------------------------------------------------------------
  13. # Programmers Note:
  14. # CNC  5/12/94  -  Initial post setup for Mill5
  15. #$Lgb$
  16. # 1.0 Jph 08/19/94 Initial source control check-in 
  17. # 1.1 jph 08/24/94 Correct coolant text 
  18. # 1.2 jph 09/02/94 Ques. 86. was 0.2 delay 
  19. # 1.3 pdr 09/06/94 Updated and corrected numbered questions 
  20. # 1.4 pdr 09/07/94 Updated reverse post name (q 93.) 
  21. #$Lge$
  22. #
  23. # --------------- 
  24. #| FEATURES:     |
  25. # ------------------------------------------------------------------------
  26. # Users Note:
  27. #
  28. # Following Misc_Reals & Misc_Integers are used:
  29. #
  30. # mi1 - Work coordinate system 
  31. #        0 = Reference return is generated and G92 with the 
  32. #            X, Y and Z home positions at file head.
  33. #        1 thru 3 = Reference return is generated and G92 with the 
  34. #                   X, Y and Z home positions at each tool.
  35. #        4 thru 9 = The WCS of G54 thru G59 respectively at each tool.
  36. #
  37. # Options / Usage:
  38. # It is recommended to start and end cutter compensation on a linear move.
  39. # Rotary axis assumes a "Z" plunge at feed into part, position of the
  40. # substituted axis at absolute zero position and the retraction from path 
  41. # by the post call to the G28 machine Z home position.
  42.  
  43. # --------------------------------------------------------------------------
  44. # DEBUG/PROGRAM SWITCHES, debugging and program switches
  45. # --------------------------------------------------------------------------
  46. bug1   : 1       # 1 = Output post to screen, 2 = output leader to screen
  47. bug2   : 0       # Append postline labels, non-zero is column position? 
  48. bug3   : 0       # Append whatline no. to each NC line?
  49. bug4   : 0       # Append NCI line no. to each NC line?
  50. whatno : yes     # Do not perform whatline branches?
  51.  
  52. arcoutput : 0    # 0 = IJK, 1 = R no sign, 2 = R signed neg. over 180
  53. breakarcs : no   # Break arcs into quadrants? 
  54. stagetool : 0    # 0 = Do not pre-stage tools, 1 = Stage tools
  55. use_gear  : no   # Set to yes to output gear range codes
  56.  
  57. # --------------------------------------------------------------------------
  58. # FORMAT STATEMENTS - n=nonmodal, l=leading, t=trailing, i=inc, d=delta
  59. # --------------------------------------------------------------------------
  60. fs  1  0.4      #Decimal, absolute, 4 place
  61. fs  2  0.4d     #Decimal, delta
  62. fs  3  1 0      #Integer, not leading
  63. fs  4  2 0l     #Integer, two leading
  64. fs  5  3 0l     #Integer, three leading
  65. fs  6  4 0l     #Integer, four leading
  66. fs  7  0.1      #Decimal, absolute, 1 place
  67. fs  8  0.2      #Decimal, absolute, 2 place
  68. fs  9  0.3      #Decimal, absolute, 3 place
  69. fs  10 0 4t     #No decimal, absolute, four trailing
  70. fs  11 0.4t     #Decimal, absolute, four trailing
  71.  
  72. # --------------------------------------------------------------------------
  73. # FORMAT ASSIGNMENTS
  74. # --------------------------------------------------------------------------
  75. # Axis output formats - Linear
  76. # --------------------------------------------------------------------------
  77. fmt  X 1 x        # X axis position
  78. fmt  Y 1 y        # Y axis position
  79. fmt  Z 1 z        # Z axis position
  80. fmt  X 1 xr       # X rapid position from tool change
  81. fmt  Y 1 yr       # Y rapid position from tool change
  82. fmt  Z 1 zr       # Z rapid position from tool change
  83. fmt  X 1 xh       # X home position
  84. fmt  Y 1 yh       # Y home position
  85. fmt  Z 1 zh       # Z home position
  86.  
  87. # --------------------------------------------------------------------------
  88. # Axis output formats - Circular
  89. # --------------------------------------------------------------------------
  90. fmt  I 2 i         # Arc center description in X
  91. fmt  J 2 j         # Arc center description in Y
  92. fmt  K 2 k         # Arc center description in Z
  93. fmt  R 1 arcrad    # Arc Radius
  94. fmt  R- 1 arcradm  # Arc Radius over 180 degree sweep
  95.  
  96. # --------------------------------------------------------------------------
  97. # Axis output formats - Rotary substitution
  98. # --------------------------------------------------------------------------
  99. fmt  A 9 xangle    # Linear to rotary calculation of X
  100. fmt  B 9 yangle    # Linear to rotary calculation of Y
  101.  
  102. # --------------------------------------------------------------------------
  103. # Program & Sequence number format
  104. # --------------------------------------------------------------------------
  105. fmt  O 6 progno    # Program number
  106. fmt  N 3 n         # Sequence nos.
  107.  
  108. # --------------------------------------------------------------------------
  109. # Tool format
  110. # --------------------------------------------------------------------------
  111. fmt  T 3 t         # Tool No
  112. fmt  T 3 first_tool# First Tool Used (bldnxtool: yes)
  113. fmt  T 3 next_tool # Next Tool Used  (bldnxtool: yes)
  114. fmt  D 3 tloffno   # Diameter Offset No
  115. fmt  H 3 tlngno    # Length Offset No
  116.  
  117. fmt  "TOOL - " 4 tnote        # Note format
  118. fmt  "DIA. OFF. - " 4 toffnote    # Note format
  119. fmt  "LENGTH - " 4 tlngnote   # Note format
  120. fmt  "DIA. - " 11 tldia           # Note format
  121.  
  122. # --------------------------------------------------------------------------
  123. # Spindle Speeds & Feedrate output formats
  124. # --------------------------------------------------------------------------
  125. fmt  S 6 speed      # Spindle Speed
  126. fmt  F 8 fr         # Feedrate
  127. fmt  F 7 frdeg      # Feedrate for rotary
  128. fmt  M 3 gear       # Gear range
  129.  
  130. # --------------------------------------------------------------------------
  131. # Drill variable formats
  132. # --------------------------------------------------------------------------
  133. fmt  G 3 drillref   # Initial / Reference Toggle (G98/G99)
  134. fmt  P 10 dwell     # Dwell
  135. fmt  Z 1 initht     # Initial Height
  136. fmt  R 1 refht      # Reference Height
  137. fmt  Z 1 depth      # Depth
  138. fmt  Q 10 peck1     # First peck increment (positive)
  139. fmt    1 peck2      # Second or last peck (positive)
  140. fmt    1 peckclr    # Safety distance
  141. fmt    1 retr       # Retract height
  142. fmt  F 8 frplunge   # Plunge feedrate in drill cycles
  143.  
  144. # --------------------------------------------------------------------------
  145. # Miscellaneous output formats
  146. # --------------------------------------------------------------------------
  147. fmt  M 5 ssrange    # Spindle Speed Range
  148. fmt  C 4 coolant    # Coolant
  149.  
  150. # --------------------------------------------------------------------------
  151. # INITIALIZE - initialize system variables and define user variables
  152. # --------------------------------------------------------------------------
  153. qtoolpln  : no     # MP386 - Enable tool plane option
  154. qtoolopt  : no     # MP386 - Enable tool optimization
  155. arctype   : 2      # Arc center 1=abs, 2=St-Ctr, 3=Ctr-St, 4=unsigned inc.
  156. bldnxtool : yes    # Build next tool table
  157. ldrcode   : 65     # Leader character dec. equiv. (fleader outputs code)
  158. ncldr     : 20     # No. of leader characters (fleader outputs code)
  159. nobrk     : no     # Omit breakup of x/y & z rapid moves
  160. omitcrlf  : no     # Omit CR/LF
  161. omitrefht : no     # Don't use reference height on first non-canned Z move
  162. omitseq   : no     # Omit sequence no.
  163. omitz     : no     # Omit first Z movement for non-canned-cycles
  164. progname  : 1      # Use uppercase for program name
  165. scalex    : 1.0    # Scaling of .NCI at input - x,y,z,i,j,k
  166. scaley    : 1.0    # Scaling of .NCI at input - x,y,z,i,j,k
  167. scalez    : 1.0    # Scaling of .NCI at input - x,y,z,i,j,k
  168. seqmax    : 9999   # Max. sequence no.
  169. skipmotest: no     # Skip motion test in linear
  170. spaces    : 1      # No. of spaces to add between fields
  171. tooltable : 1      # Read for tool table and pwrtt 
  172.  
  173. absswp    : 0      # Absolute sweep
  174. drlgsel   : -1     # Drill Select Initialize
  175. maxfrdeg  : 999    # Limit for feed in deg/min
  176. absinc    : 0      # Absolute/Incremental toggle for modality 
  177. tcnt      : 0      # Count the number of tool changes
  178. adelta    : 0      # Calculation for deg/min
  179. ldelta    : 0      # Calculation for deg/min
  180. zdelta    : 0      # Calculation for deg/min
  181. alzdelta  : 0      # Calculation for deg/min
  182. frdelta   : 0      # Calculation for deg/min
  183. frdegcalc : 0      # Calculation for deg/min
  184. circum    : 0      # Calculation for deg/min
  185. rotstrt   : 1      # Flag for first rotary position
  186.  
  187. # --------------------------------------------------------------------------
  188. # FORMULAS - global formulas
  189. # --------------------------------------------------------------------------
  190. ssrange   = mi3              # Gear Range Select
  191. speed     = abs ( ss )       # Absolute spindle speed
  192. arcradm   = arcrad           # Negative arcrad
  193. spdlsel   = fsg3(ss)         # Spindle on selector based on pos. or neg. ss
  194.  
  195. # --------------------------------------------------------------------------
  196. # CANNED CYCLES - select long or short code
  197. # --------------------------------------------------------------------------
  198. usecandrill : yes  # Use canned cycle for drill
  199. usecanpeck  : yes  # Use canned cycle for Peck
  200. usecanchip  : yes  # Use canned cycle for Chip Break
  201. usecantap   : yes  # Use canned cycle for Tap
  202. usecanbore1 : yes  # Use canned cycle for Bore1
  203. usecanbore2 : yes  # Use canned cycle for Bore2
  204. usecanmisc1 : yes  # Use canned cycle for Misc1
  205. usecanmisc2 : yes  # Use canned cycle for Misc2
  206.  
  207. # --------------------------------------------------------------------------
  208. # Lookup table definitions - for math functions FLOOK and FRANGE
  209. # --------------------------------------------------------------------------
  210. flktbl    1     3  # Lookup table definitions - table no. - no. entries
  211.          40  1000  # Low gear range
  212.          41  2500  # Med gear range
  213.          42  5000  # Hi gear range
  214.  
  215. # --------------------------------------------------------------------------
  216. # Strings - String labels must start with 's' - they are not pre-assigned
  217. # --------------------------------------------------------------------------
  218. #Select operation note
  219. sop00   NULL             # String definition
  220. sop01   2D-CONTOUR       #    "       "
  221. sop02   3D-CONTOUR       #    "       "
  222. sop03   DRILL/MISC       #    "       "
  223. sop04   POCKET....       #    "       "
  224. sop05   RULED.....       #    "       "
  225. sop06   2D-SWEPT..       #    "       "
  226. sop07   3D-SWEPT..       #    "       "
  227. sop08   REVOLVED..       #    "       "
  228. sop09   LOFT......       #    "       "
  229. sop10   COONS.....       #    "       "
  230. sop11   TRIM .....       #    "       "
  231. sop12   FILLET....       #    "       "
  232. sop13   ROUGH.....       #    "       "
  233. sop14   OP14......       #    "       "
  234. sop15   OP15......       #    "       "
  235.  
  236. sopnote                  # Target string
  237.  
  238. fstrsel  sop00 opcode sopnote  
  239.  
  240. # --------------------------------------------------------------------------
  241. # Select motion G code 
  242. sg00    G0    # Linear movement at rapid feedrate 
  243. sg01    G1    # Linear movement at feedrate 
  244. sg02    G2    # Circular interpolation CW 
  245. sg03    G3    # Circular interpolation CCW 
  246.  
  247. sgcode        # Target string  
  248.  
  249. fstrsel  sg00 gcode sgcode    
  250.  
  251. # --------------------------------------------------------------------------
  252. # Select incremental or absolute G code 
  253. sg90    G90   # Absolute G code
  254. sg91    G91   # Incremental G code
  255.  
  256. sgabsinc      # Target string  
  257.  
  258. fstrsel  sg90 absinc sgabsinc    
  259.  
  260. # --------------------------------------------------------------------------
  261. # Select spindle start 
  262. sm04    M4    # Spindle reverse        
  263. sm05    M5    # Spindle off            
  264. sm03    M3    # Spindle forward        
  265.  
  266. spdlon        # Target string              
  267.  
  268. fstrsel  sm04 spdlsel spdlon
  269.  
  270. # --------------------------------------------------------------------------
  271. # Cutter compensation code 
  272. scc0    ""    # Cutter compensation state not changed
  273. sg40    G40   # Cancel cutter compensation
  274. sg41    G41   # Cutter compensation left
  275. sg42    G42   # Cutter compensation right
  276. sg140   G40   # Last linear move cancel cutter comp (see note)
  277.               # Note: to cancel comp after last move, remove G40 string
  278.               # with sg140 and remove "#" at the postline call "pcancelcc"
  279.  
  280. sccomp        # Target string
  281.  
  282. fstrsel  scc0 ccomp sccomp
  283.  
  284. # --------------------------------------------------------------------------
  285. # Select work plane G code
  286. sg17    G17   # XY plane code 
  287. sg19    G19   # XZ plane code 
  288. sg18    G18   # YZ plane code 
  289.  
  290. sgplane       # Target string
  291.  
  292. fstrsel  sg17 plane sgplane      
  293.  
  294. # --------------------------------------------------------------------------
  295. # Work coordinate system 
  296. sg50    G92   # Work coordinate system G code
  297. sg51    G92   #  "       "        "    "  "
  298. sg52    G92   #  "       "        "    "  "
  299. sg53    G92   #  "       "        "    "  " 
  300. sg54    G54   #  "       "        "    "  "
  301. sg55    G55   #  "       "        "    "  "
  302. sg56    G56   #  "       "        "    "  "
  303. sg57    G57   #  "       "        "    "  "
  304. sg58    G58   #  "       "        "    "  "
  305. sg59    G59   #  "       "        "    "  "
  306.  
  307. sgwcs         # Target string
  308.  
  309. fstrsel  sg50 mi1 sgwcs
  310.  
  311. # --------------------------------------------------------------------------
  312. # Canned drill cycle string select
  313. sg81     G81  #  drill      - no dwell 
  314. sg81d    G82  #  drill      - with dwell 
  315. sg83     G83  #  peck drill - no dwell 
  316. sg83d    G83  #  peck drill - with dwell 
  317. sg73     G73  #  chip break - no dwell 
  318. sg73d    G73  #  chip break - with dwell 
  319. sg84     G84  #  tap        - no dwell
  320. sg84d    G74  #  tap        - with dwell (selects left hand)
  321. sg85     G85  #  bore #1    - no dwell 
  322. sg85d    G89  #  bore #1    - with dwell 
  323. sg86     G86  #  bore #2    - no dwell 
  324. sg86d    G86  #  bore #2    - with dwell 
  325. sgm1     G81  #  misc #1    - no dwell
  326. sgm1d    G82  #  misc #1    - with dwell
  327. sgm2     G81  #  misc #2    - no dwell
  328. sgm2d    G82  #  misc #2    - with dwell
  329.  
  330. sgdrill       #  Target string
  331.  
  332. drlgsel = drillcyc * 2 + fsg2 ( dwell )  # 16 possible combinations:
  333.                                      #   drillcyc = 0..7
  334.                                      #   dwell    = 0 or non-zero (2 states)
  335. fstrsel  sg81 drlgsel sgdrill        
  336.  
  337. # --------------------------------------------------------------------------
  338. # Generate 'sgear' string
  339. sgear0      M**   # auto gear range
  340. sgear1      M41   # Low gear range
  341. sgear2      M42   # Med gear range
  342. sgear3      M43   # High gear range - selected in parameters by mi3
  343. sgear
  344.  
  345. fstrsel sgear0 gear sgear
  346.  
  347. # --------------------------------------------------------------------------
  348. # POSTLINES, USER-DEFINED -  Postline labels start with 'p'.
  349. # End a line with ',' to continue on the next line.
  350. # End a line with ', e' to generate carriage return and linefeed.
  351. # --------------------------------------------------------------------------
  352. # Program general output control, user defined 
  353. # --------------------------------------------------------------------------
  354. pinit      # Initialize Vars
  355.              prv_fr = 999.999         
  356.              prv_frdeg = 999.999      
  357.              prv_frplunge = 999.999   
  358.              linarc = 0
  359.              rotstrt = 1
  360.  
  361. pcomment   # Manual Entry - COMMENTS (on a block by itself) 1005,1006
  362.              "(", scomm, ")"
  363.  
  364. pabs       # Absolute G code output
  365.              absinc = 0
  366.              sgabsinc
  367.  
  368. pinc       # Incremental G code output
  369.              absinc = 1
  370.              sgabsinc
  371.  
  372. pcooloff   # Coolant off "M" code output
  373.              if prv_coolant > 0, "M09"
  374.  
  375. pcoolon    # Coolant off "M" code output
  376.              if coolant = 1, "M08"     # Flood
  377.              if coolant = 2, "M08"     # Mist
  378.  
  379. pcoolnl    # Coolant off "M" code output
  380.              if coolant = 0, "M09"     # Off
  381.              if coolant = 1, "M08"     # Flood
  382.              if coolant = 2, "M08"     # Mist
  383.  
  384. pfr        # Feedrate W/O Negative Feedrates
  385.              if fr > 0, fr
  386.  
  387. pcan       # Canned text - cantext = 0, 1, 2, 3
  388.              if cantext = 1, "M01"        #optional stop
  389.              if cantext = 2, " "           #user option
  390.              if cantext = 3, " "           #user option
  391.  
  392. # --------------------------------------------------------------------------
  393. # Work coordinate output, user defined 
  394. # --------------------------------------------------------------------------
  395. pg92_sof   # G92 coordinate setting at start
  396.              "/", n, pinc, "G28", "Z0.", e
  397.              "/", n, "G28", "X0.", "Y0.", e
  398.              "/", n, *sgwcs, *xh, *yh, *zh, e
  399.  
  400. pg92_out   # G92 coordinate setting at tool change
  401.              "/", n, "G28", "X0.", "Y0.", e
  402.              if gcode <> 1003, "/", n, *sgwcs, *xh, *yh, *zh, e
  403.  
  404. pg92_tst   # G92 coordinate test for output 
  405.              if mi1 > 0, pg92_out
  406.  
  407. pwcs       # G54+ coordinate setting
  408.              if mi1 >= 4, *sgwcs
  409.  
  410. # --------------------------------------------------------------------------
  411. # Gear selection control, user defined 
  412. # --------------------------------------------------------------------------
  413. pgear      # Find spindle range
  414.              gear = frange ( 1, speed )
  415.              *gear
  416.  
  417. prange     # Find spindle range
  418.              if use_gear = 1, pgear
  419.  
  420. # --------------------------------------------------------------------------
  421. # Cutter comp. output control, user defined 
  422. # --------------------------------------------------------------------------
  423. pccdia2    # Cutter Compensation2
  424.              if ccomp <> 4, tloffno
  425.  
  426. pccdia     # Cutter Compensation
  427.              if ccomp <> 0, pccdia2
  428.  
  429. # --------------------------------------------------------------------------
  430. # Axis substitution motion, user defined 
  431. # --------------------------------------------------------------------------
  432. pdrlxyrot  # Substitute Axis X/Y with Rotary axis w/ drilling
  433.            xangle = xs
  434.            yangle = ys
  435.            if rotaxis = 0, x, y
  436.            if rotaxis = 1, y, xangle
  437.            if rotaxis = 2, x, yangle
  438.  
  439. pfrd       # Feedrate W/O Negative Feedrates (deg/min)
  440.            if frdeg > maxfrdeg, frdeg = maxfrdeg
  441.            if frdelta > .5, *frdeg           #Value to exceed to output frdeg         
  442.  
  443. protaxis1a # Substitute Axis X/Y with Rotary axis 
  444.            if rotstrt = 0, n, sgcode, y, z, *xangle, pfrd, pcan, e
  445.            if rotstrt = 1, n, xangle, e
  446.            if rotstrt = 1, n, sgcode, y, z, pfrd, pcan, e
  447.            
  448. protaxis1  # Substitute Axis X/Y with Rotary axis 
  449.            if gcode = 0, n, sgcode, y, z, *xangle, pcan, e
  450.            if gcode = 1, protaxis1a
  451.            
  452. protaxis2a # Substitute Axis X/Y with Rotary axis 
  453.            if rotstrt = 0, n, sgcode, x, z, *yangle, pfrd, pcan, e
  454.            if rotstrt = 1, n, yangle, e
  455.            if rotstrt = 1, n, sgcode, x, z, pfrd, pcan, e
  456.  
  457. protaxis2  # Substitute Axis X/Y with Rotary axis 
  458.            if gcode = 0, n, sgcode, x, z, *yangle, pcan, e
  459.            if gcode = 1, protaxis2a
  460.  
  461. protaxis   # Substitute Axis X/Y with Rotary axis 
  462.            xangle = xs
  463.            yangle = ys
  464.            if rotstrt = 1, !fr
  465.            if fr < 0, fr = prv_fr
  466.            !fr
  467.            if rotaxis = 1, ldelta = abs ( y - prv_y )
  468.            if rotaxis = 2, ldelta = abs ( x - prv_x )
  469.            zdelta = abs ( z - prv_z )
  470.  if rotaxis = 1, adelta = ( ( abs ( xangle - prv_xangle ) ) / 360 ) * circum
  471.  if rotaxis = 2, adelta = ( ( abs ( yangle - prv_yangle ) ) / 360 ) * circum
  472.            alzdelta = sqrt ( adelta^2 + ldelta ^2 + zdelta^2 )
  473.            frdegcalc =  fr * ( 360 / circum )
  474.  if alzdelta <> 0, frdeg = ( adelta / alzdelta ) * frdegcalc
  475.            if adelta = 0, frdeg = fr
  476.            frdelta = abs ( frdeg - prv_frdeg )
  477.            if rotaxis = 1, protaxis1
  478.            if rotaxis = 2, protaxis2
  479.            if gcode = 1, rotstrt = 0
  480.            !x, !y, !z
  481.  
  482. protary    # Rotary Move
  483.              if rotaxis = 1, xr = 0  #Force X to zero
  484.              if rotaxis = 2, yr = 0  #Force Y to zero
  485.              if rotaxis > 0, linarc = 1
  486.              circum = rotdia * pi
  487.  
  488. # --------------------------------------------------------------------------
  489. # Axis linear/circular motion, user defined 
  490. # --------------------------------------------------------------------------
  491. parctyp2   # Arc output for R w/ sign over 180 degree sweep
  492.              absswp = abs ( sweep )
  493.              if absswp <= 180, *arcrad
  494.              if absswp > 180, *arcradm
  495.  
  496. parctyp1   # Arc output for R w/ no sign
  497.              *arcrad
  498.  
  499. parctyp0   # Arc output for IJK
  500.              if plane = 0, *i, *j, k
  501.              if plane = 1, i, *j, *k
  502.              if plane = 2, *i, j, *k
  503.  
  504. parctyp    # Select the arc output
  505.              if arcoutput = 0, parctyp0
  506.              if arcoutput = 1, parctyp1
  507.              if arcoutput = 2, parctyp2
  508.  
  509. prapidm    # Linear line movement - at rapid feedrate              
  510.              n, sgplane, sccomp, pccdia, sgcode, x, y, z, pcan
  511.  
  512. plinm      # Linear line movement - at feedrate                    
  513.              n, sccomp, pccdia, sgcode, x, y, z, pfr, pcan
  514.  
  515. pcirm      # Circular interpolation                                
  516.              n,  sgplane, sccomp, pccdia, sgcode, x, y, z, parctyp, pfr, pcan
  517.  
  518. # --------------------------------------------------------------------------
  519. # Drilling, user defined 
  520. # --------------------------------------------------------------------------
  521.  
  522. pdrillref  # Determine G98 or G99
  523.              if initht <> refht, drillref = 98
  524.              if initht = refht, drillref = 99
  525.  
  526. pdwell     # Determine whether to output dwell
  527.              if dwell <> 0, *dwell
  528.  
  529. ptlchg0dr3 # Null tool change for drilling
  530.              gcode = 0
  531.              if zr < prv_zr, n, sgcode, *xr, *yr, e                             
  532.              n, sgcode, *zr, e
  533.  
  534. ptlchg0dr2 # Null tool change for drilling
  535.              if zr <> prv_zr, ptlchg0dr3                             
  536.  
  537. ptlchg0drl # Null tool change for drilling
  538.              if prv_opcode = 3, ptlchg0dr2                             
  539.  
  540. # --------------------------------------------------------------------------
  541. # POSTLINES, PRE-DEFINED - Postline names are pre-assigned.
  542. # Lines do not need to end with ', e' for carriage return and linefeed.
  543. # --------------------------------------------------------------------------
  544. pheader    # File header
  545.              "(PROGRAM NAME -", progname, ")"
  546.       "(DATE, Day-Month-Year - ", date, " TIME, Hr:Min - ", time, ")"
  547.  
  548. psof0      # Start of file for tool zero                        
  549.              psof
  550.  
  551. psof       # Start of file for non-zero tool number             
  552.              pinit
  553.              !opcode, !coolant
  554.              if tcnt = 1, stagetool = 2
  555.              " ", e
  556.              "%"
  557.              progno
  558.              comment
  559.              n, "G00 G40 G49 G80 G90"
  560.              if mi1 <= 3, pg92_sof
  561.              if stagetool = 0, n, *t, "M06"
  562.              if stagetool = 1, n, *next_tool, "M06"
  563.              protary
  564.              n, "G00", pabs, pwcs, *xr, *yr, *speed, *spdlon, prange
  565.              n, "G43", tlngno, *zr, pcoolon
  566.  
  567. ptlchg0    # Null tool change                                   
  568.              if opcode = 3, ptlchg0drl
  569.              if prv_speed <> speed, n, speed
  570.              if coolant <> prv_coolant, n, pcoolnl
  571.              !opcode, !zr, !coolant
  572.  
  573. ptlchg     # Tool change                                        
  574.              pinit
  575.              !opcode
  576.              n, "M05"
  577.              n, pinc, "G28", "Z0.", pcooloff
  578.              if mi1 <= 3, pg92_tst
  579.              if stagetool = 0, n, *t, "M06"
  580.              if stagetool = 1, n, *next_tool, "M06"
  581.              n, "M01"
  582.              comment
  583.              protary
  584.              n, "G00", pabs, pwcs, *xr, *yr, *speed, *spdlon, prange
  585.              n, "G43", tlngno, *zr, pcoolon
  586.              !coolant
  587.  
  588. peof0      # End of file for tool zero                          
  589.              peof
  590.  
  591. peof       # End of file for non-zero tool                      
  592.              n, "M05"
  593.              n, pinc, "G28", "Z0.", pcooloff
  594.              if mi1 <= 3, pg92_tst
  595.              if stagetool = 1, n, *first_tool, "M06"
  596.              n, pabs
  597.              n, "M30"
  598.              "%"
  599.  
  600. # --------------------------------------------------------------------------
  601. # Axis motion 
  602. # --------------------------------------------------------------------------
  603. prot0      # Toolplane postline - Custom post required
  604.  
  605. prot       # Toolplane postline - Custom post required
  606.  
  607. prapid     # Linear line movement - at rapid feedrate              
  608.              if rotaxis <> 0, protaxis
  609.              if rotaxis = 0, prapidm
  610.  
  611. pzrapid    # Linear movement in Z axis only - at rapid feedrate    
  612.              n, sgcode, z
  613.  
  614. plin1      # First linear movement after SOF, whatno must be set                       
  615.  
  616. plin2      # Second linear movement after SOF, whatno must be set                      
  617.  
  618. plin       # Linear line movement - at feedrate                    
  619.              if rotaxis <> 0, protaxis
  620.              if rotaxis = 0, plinm
  621.  
  622. pz         # Linear movement in Z axis only - at feedrate          
  623.              n, sgcode, z, pfr
  624.  
  625. pcir1      # First circular movement after SOF, whatno must be set                     
  626.  
  627. pcir2      # Second circular movement after SOF, whatno must be set                    
  628.  
  629. pcir       # Circular interpolation                                
  630.              if rotaxis <> 0, protaxis
  631.              if rotaxis = 0, pcirm
  632.  
  633. # --------------------------------------------------------------------------
  634. # Drilling 
  635. # --------------------------------------------------------------------------
  636. pdrill     # Canned Drill Cycle
  637.              pdrillref
  638.        n, *drillref, *sgdrill, pdrlxyrot, *depth, *refht, pdwell, *frplunge
  639.  
  640. ppeck      # Canned Peck Drill Cycle
  641.              pdrillref
  642.        n, *drillref, *sgdrill, pdrlxyrot, *depth, *refht, *peck1, *frplunge
  643.  
  644. pchpbrk    # Canned Chip Break Cycle
  645.              pdrillref
  646.        n, *drillref, *sgdrill, pdrlxyrot, *depth, *refht, *peck1, *frplunge
  647.  
  648. ptap       # Canned Tap Cycle
  649.              pdrillref
  650.        n, *drillref, *sgdrill, pdrlxyrot, *depth, *refht, *frplunge
  651.  
  652. pbore1     # Canned Bore #1 Cycle
  653.              pdrillref
  654.        n, *drillref, *sgdrill, pdrlxyrot, *depth, *refht, pdwell, *frplunge
  655.  
  656. pbore2     # Canned Bore #2 Cycle
  657.              pdrillref
  658.        n, *drillref, *sgdrill, pdrlxyrot, *depth, *refht, *frplunge
  659.  
  660. pmisc1     # Canned Misc #1 Cycle (User Option)
  661.              pdrill
  662.  
  663. pmisc2     # Canned Misc #2 Cycle (User Option)
  664.              pdrill
  665.  
  666. pdrill_2   # Canned Drill Cycle
  667.            n, pdrlxyrot, refht, depth
  668.              
  669.  
  670. ppeck_2    # Canned Peck Drill Cycle
  671.              pdrill_2
  672.  
  673. pchpbrk_2  # Canned Chip Break Cycle
  674.              pdrill_2
  675.  
  676. ptap_2     # Canned Tap Cycle
  677.              pdrill_2
  678.  
  679. pbore1_2   # Canned Bore #1 Cycle
  680.              pdrill_2
  681.        
  682. pbore2_2   # Canned Bore #2 Cycle
  683.              pdrill_2
  684.  
  685. pmisc1_2   # Canned Misc #1 Cycle
  686.              pdrill_2
  687.  
  688. pmisc2_2   # Canned Misc #2 Cycle
  689.              pdrill_2
  690.  
  691. pcanceldc  # Cancel canned drill cycle
  692.              !gcode
  693.              n, "G80"
  694.  
  695. pcancelcc  # Cancel cutter comp.
  696.              #n, "G40"
  697.  
  698. pwrtt      # Write tool table, scans entire file, null tools are negative
  699.              tnote = t 
  700.              toffnote = tloffno
  701.              tlngnote = tlngno
  702.  if t >= 0, "(", *tnote, " ", *toffnote, " ", *tlngnote, " ", *tldia, " ",
  703.             *sopnote, ")"
  704.              if t >= 0, tcnt = tcnt + 1
  705.  
  706. # --------------------------------------------------------------------------
  707. # Numbered questions for Mastercam --  Used by Mill 5
  708. # --------------------------------------------------------------------------
  709. 38. Rapid feedrate? 300.0
  710. 76. Configuration file name? 
  711. 80. Communications port number for receive and transmit (1 or 2) ? 2
  712. 81. Data rate (110,150,300,600,1200,2400,4800,9600,14400,19200,38400)? 300 
  713. 82. Parity (E/O/N)? E
  714. 83. Data bits (7 or 8)? 7
  715. 84. Stop bits (1 or 2)? 2
  716. 85. Strip line feeds? N
  717. 86. Delay after end of line (seconds)? 0
  718. 87. Ascii, Eia, or Binary (A/E/B)? A
  719. 88. Echo keyboard to screen in terminal emulation? n
  720. 89. Strip carriage returns? N
  721. 90. Drive and subdirectory for NC and Material files?
  722. 91. Name of executable post processor? MP
  723. 92. Name of reverse post processor? RP
  724. 93. Reverse post PST file name? RPFAN
  725. 100. Number of places BEFORE the decimal point for sequence numbers? 3
  726. 101. Number of places AFTER the decimal point for sequence numbers? 0
  727. 103. Maximum spindle speed? 5000
  728. 107. Average time for tool change (seconds)? 2.0
  729. 110. Default tool library? TOOLS.MTL
  730.  
  731. # --------------------------------------------------------------------------
  732. # Default Miscellaneous Real Values
  733. # --------------------------------------------------------------------------
  734. 201. Default miscellaneous real variable 1 (mr1)? 0.0
  735. 202. Default miscellaneous real variable 2 (mr2)? 0.0
  736. 203. Default miscellaneous real variable 3 (mr3)? 0.0
  737. 204. Default miscellaneous real variable 4 (mr4)? 0.0
  738. 205. Default miscellaneous real variable 5 (mr5)? 0.0
  739. 206. Default miscellaneous real variable 6 (mr6)? 0.0
  740. 207. Default miscellaneous real variable 7 (mr7)? 0.0
  741. 208. Default miscellaneous real variable 8 (mr8)? 0.0
  742. 209. Default miscellaneous real variable 9 (mr9)? 0.0
  743. 210. Default miscellaneous real variable 10 (mr10)? 0.0
  744.  
  745. # --------------------------------------------------------------------------
  746. # Default Miscellaneous Integer Values
  747. # --------------------------------------------------------------------------
  748. 301. Default Work Coordinate System (0 thru 3=G92, 4 thru 9=G54-G59)? 1
  749. 302. Miscellaneous integer variable 2 (mi4)? 0
  750. 303. Miscellaneous integer variable 3 (mi4)? 0
  751. 304. Miscellaneous integer variable 4 (mi4)? 0
  752. 305. Miscellaneous integer variable 5 (mi5)? 0
  753. 306. Miscellaneous integer variable 6 (mi6)? 0
  754. 307. Miscellaneous integer variable 7 (mi7)? 0
  755. 308. Miscellaneous integer variable 8 (mi8)? 0
  756. 309. Miscellaneous integer variable 9 (mi9)? 0
  757. 310. Miscellaneous integer variable 10 (mi10)? 0
  758.